package com.itheima.demo5;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Demo {
    public static void main(String[] args) throws IOException {
        // 创建服务器端对象
        ServerSocket serverSocket = new ServerSocket(8888);
        System.out.println("服务器启动，绑定端口11111");
        while (true) {
            // 监听连接，接收客户端的请求，每当有请求就建立一个连接
            Socket socket = serverSocket.accept();
            // 开启线程
            new Thread(new ServerThread(socket)).start();
        }
    }
}
